(function(window, document) {
	function toast(container, content, duration) {
		this.container = document.getElementById(container);
		this.content = content || "这是一段对话";
		this.duration = duration || 2000;
	}
	
	toast.prototype.show = function(callback) {
		this.callback = callback || function () {};
		this.container.style.opacity = 1;
		this.container.style.display = "block";
		this.container.innerHTML = this.content;
		
		setTimeout(function() {
			this.callback && this.callback();
			this.hide();
		}.bind(this), this.duration);
		
		return this;
	}
	
	toast.prototype.hide = function(callback) {
		this.callback = callback || function() {};
		
		this.container.style.display = "none";
		this.callback && this.callback();
		return this;
	}
	window.toast = toast;
})(window, document)
